Home > biomechZoo > Toolbox > Support Functions > ctransform.m

ctransform

PURPOSE ^

vout = CTRANSFORM(c1,c2,vec) will transform a vector from c1 to c2 (T2/1)

SYNOPSIS ^

function vout = ctransform(c1,c2,vec)

DESCRIPTION ^

 vout = CTRANSFORM(c1,c2,vec) will transform a vector from c1 to c2 (T2/1)

 ARGUMENTS
   c1    ... initial coordinate system 3 by 3 matrix rows = i,j,k columns =X,Y,Z
   c2    ... final coordinate system 3 by 3 matrix rows = i,j,k columns =X,Y,Z
   vec   ... n x 3 matrix in c1 rows = samples; columns X Y Z

 RETURNS
   vout  ... n x 3 matrix in c2 rows = samples; columns X Y Z 


 Example
 Let us consider two coordinate systems
 c1 = [1 0 0;  0 1 0; 0 0 1]  % in line with the global coordinate system
 c2 = [0 1 0; -1 0 0; 0 0 1]  % rotated version of c1 90deg about z axis
 
 what would be the coordinates of a vector vec = [2 0 0] from c1 expressed in c2?

 vout = ctransform(c1,c2,vec)

 vout = [0 -2 0]

 see also vecrotate, gunit

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:
Generated on Sun 10-Mar-2024 22:39:06 by m2html © 2005